# $Id: PKGBUILD 469 2011-11-09 07:42:20Z pupykins $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=firefox-scrapbook
pkgver=1.4.7
pkgrel=2
pkgdesc="plugin for firefox which can save and organize saved pages"
arch=('any')
url="http://amb.vis.ne.jp/mozilla/scrapbook/"
license=('GPL2')
depends=("firefox")
makedepends=('unzip')
_addons_file=41964
source=(scrapbook-$pkgver-fx.xpi::https://addons.mozilla.org/en-US/firefox/downloads/latest/427/)
md5sums=('a1b7b43a9647d7722169a91d35ae29c8')

build() {
    cd $srcdir
    local emid=$(sed -n -e '/<\?em:id>\?/!d; s/.*\([\"{].*[}\"]\).*/\1/; s/\"//g; p; q' install.rdf)
    local dstdir=$pkgdir/usr/lib/firefox/extensions/${emid}
    install -d $dstdir
    sed -i 's#<em:maxVersion>.*</em:maxVersion>#<em:maxVersion>20.*</em:maxVersion>#' install.rdf
    cp -R * $dstdir
    rm $dstdir/scrapbook-$pkgver-fx.xpi
}
